class GuaScene {
    constructor(game) {
        this.game = game
        this.debugModeENabled = true
        this.elements = []
        this.score = 0
    }


    static new(game) {
        let i = new this(game)
        return i
    }

    addElement(img) {
        img.scene = this
        this.elements.push(img)
    }


    //加一个removeElement方法删除元素

    removeElement(node){
        this.elements = this.elements.filter(e => e != node)
    }
    draw() {

        for (let e of this.elements) {
            e.draw()
        }
        // this.setupScore()
    }

    update() {

        this.debug  && this.debug()
        if (this.debugModeENabled) {
            for (let i = 0; i < this.elements.length; i++) {
                let e = this.elements[i]
                e.debug && e.debug()
            }
        }
        for (let i = 0; i < this.elements.length; i++) {
            let e = this.elements[i]
            e.update()
        }
    }
}

